package com.dc.designPattern._999_multi_pattern.demo_1;

import com.dc.designPattern._999_multi_pattern.demo_1.price.CalPriceFactory;
import lombok.Data;

/**
 * Description: 消费类
 * @author: gdc
 * @date: 2021/6/10
 * @version 1.0
 */
@Data
public class Player {

    /**
     * 消费总金额
     */
    private Double totalAmount = 0D;
    /**
     * 客户单次消费金额
     */
    private Double amount;

    /**
     * 支付
     * @param amount            支付金额
     */
    public void buy(Double amount) {
        this.amount = amount;
        totalAmount += amount;
    }

    /**
     * 获取客户最终消费的金额
     * @return          最终消费金额
     */
    public Double calLastAmount(){
        return CalPriceFactory.create(this).calPrice(amount);
    }

}
